﻿function ToggleInjuries( ddlInjury1ID, ddlInjury2ID, ddlInjury3ID )
{
    var ddlInjury1 = ControlWith( ddlInjury1ID );
    var ddlInjury2 = ControlWith( ddlInjury2ID );
    var ddlInjury3 = ControlWith( ddlInjury3ID );
    if( ddlInjury1.selectedIndex == 0 )
    {
        ddlInjury2.selectedIndex = 0;
    }
    if( ddlInjury2.selectedIndex == 0 )
    {
        ddlInjury3.selectedIndex = 0;
    }
    ddlInjury2.disabled =  ( ddlInjury1.selectedIndex == 0 );
    ddlInjury3.disabled =  ( ddlInjury2.selectedIndex == 0 );
}

function ToggleFamilySection( chkFamilyPresentID, phFamilyPresentSectionID, txtCityOfOriginID, txtDtFamilyArrivedID )
{
    var chkFamilyPresent = ControlWith( chkFamilyPresentID );
    var phFamilyPresentSection = ControlWith( phFamilyPresentSectionID );
    var txtCityOfOrigin = ControlWith( txtCityOfOriginID );
    var txtDtFamilyArrived = ControlWith( txtDtFamilyArrivedID );
    txtCityOfOrigin.disabled = !chkFamilyPresent.checked;
    txtDtFamilyArrived.disabled = !chkFamilyPresent.checked;
    phFamilyPresentSection.disabled = !chkFamilyPresent.checked;
}

function ControlWith( id )
{
    return document.getElementById( id );
}